#pragma once
#include "../mqcomm/mq_log.hpp"
#include "../mqcomm/mq_helper.hpp"
#include "../mqcomm/mq_msg.pb.h"

#include <iostream>
#include <mutex>
#include <memory>
#include <vector>
#include <functional>

namespace ns_kkymq
{
    using ConsumerCallback = std::function<void(const std::string &tag, const BasicProperties *bp, const std::string &body)>;
    struct Consumer
    {
        using ptr = std::shared_ptr<Consumer>;
        std::string _tag;    // 消费者标识
        std::string _q_name; // 消费者订阅的队列名称
        bool _auto_ack;      // 自动确认标志
        ConsumerCallback _callback;

        Consumer(){
            lg(Debug,"new Consumer: %p", this);
        }
        Consumer(const std::string &tag, const std::string &q_name, bool ack, const ConsumerCallback &cb)
            : _tag(tag), _q_name(q_name), _auto_ack(ack), _callback(cb)
        {
            lg(Debug,"new Consumer: %p",this);
        }
        ~Consumer()
        {
            lg(Debug,"delete Consumer: %p",this);
        }
    };
}